/*
 * @Author       : 魏威 <1209562577@qq.com>
 * @Date         : 2022-02-10 17:04 周4
 * @Description  :
 */

import { Form, Input } from "antd";
import { UserSelect } from "components/user-select";
import React from "react";
import { Project, User } from "types";

interface SearchPanelProps {
  users: User[];
  param: Partial<Pick<Project, "name" | "personId">>;
  setParam: (param: SearchPanelProps["param"]) => void;
}

export default function SearchPanel(props: SearchPanelProps) {
  const { param, setParam } = props;

  return (
    <Form layout={"inline"} style={{ marginBottom: "2rem" }}>
      <Form.Item label={"项目名"}>
        <Input
          type="text"
          value={param.name}
          onChange={(evt) => setParam({ ...param, name: evt.target.value })}
          placeholder={"项目名"}
        />
      </Form.Item>
      <Form.Item label={"负责人"}>
        <UserSelect
          value={param.personId}
          onChange={(value) => setParam({ ...param, personId: value })}
        />
      </Form.Item>
    </Form>
  );
}
